﻿using Cassandraemon;
using Microsoft.VisualStudio.TestTools.UnitTesting;

namespace Cassandraemon.Test
{
    [TestClass]
    public class ComparerTest
    {
        [TestMethod]
        public void SequenceComparerTest()
        {
            var target = SequenceComparer<int>.Default;
            Assert.IsTrue(target.Equals(new[] { 1, 2, 3 }, new[] { 1, 2, 3 }));
            Assert.IsTrue(target.Equals(null, null));
        }

        [TestMethod]
        public void SequenceComparerFailTest()
        {
            var target = SequenceComparer<int>.Default;
            Assert.IsFalse(target.Equals(new[] { 1, 2, 3 }, new[] { 1, 3, 2 }));
            Assert.IsFalse(target.Equals(new[] { 1, 2, 3 }, new[] { 1, 2 }));
            Assert.IsFalse(target.Equals(new[] { 1, 2, 3 }, new[] { 1, 2, 3, 4 }));
            Assert.IsFalse(target.Equals(new[] { 1, 2, 3 }, null));
            Assert.IsFalse(target.Equals(null, new[] { 1, 2, 3 }));
        }
    }
}
